<script setup lang="ts">
import PageSearch from "@/views/main/system/department/c-cpns/page-search.vue";
import PageContent from "@/views/main/system/department/c-cpns/page-content.vue";
import {useTemplateRef} from "vue";
import PageModal from "@/views/main/system/department/c-cpns/page-modal.vue";

const contentRef = useTemplateRef<InstanceType<typeof PageContent>>('contentRef')
const modalRef = useTemplateRef<InstanceType<typeof PageModal>>('modalRef')
const handleQueryClick = (queryInfo: any) => {
  contentRef.value?.fetchPageListData(queryInfo);
}
const handleResetClick = () => {
  contentRef.value?.fetchPageListData();
}
const handleNewClick = () => {
  modalRef.value?.setDialogVisible(true)
}
const handleEditClick = (itemData: any) => {
  modalRef.value?.setDialogVisible(false, itemData)
}
</script>

<template>
  <div class="department-wrapper">
    <page-search @query-click="handleQueryClick" @reset-click="handleResetClick"/>
    <page-content ref="contentRef" @new-data-click="handleNewClick" @edit-data-click="handleEditClick"/>
    <page-modal ref="modalRef"/>
  </div>
</template>

<style scoped>

</style>
